
package com.be.beadmin.service.repository;

import com.be.beadmin.service.entity.DictData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
* @author zjm
* @date 2023-02-02
**/
public interface DictDataRepository extends JpaRepository<DictData, String>, JpaSpecificationExecutor<DictData> {

    DictData findDictDataByIdAndDelete(String id, Integer delete);

    DictData findDictDataById(String id);

    List<DictData> findDictDataByDictTypeId(String dictTypeId);


    DictData findDictDataByDictTypeIdAndKeyName(String dictTypeId,String key);
//    List<DictData> findDictDataByDictType(DictType dictType);


    List<DictData> findDictDataByDictTypeIdAndDelete(String dictTypeId, Integer delete);


    List<DictData> findDictDataByDictTypeIdAndDeleteOrderByDictSortAsc(String dictTypeId, Integer delete);


    List<DictData> findDictDataByDictTypeIdAndDeleteOrderByDictSortDesc(String dictTypeId, Integer delete);

//    @Query(value = "select D.keyName from DictData D where D.dictType = ?",nativeQuery = true)  //where D.dictType = ?
//    List<String> findDictDataKeyNameByDictType(DictType dictType);

}